//
//  NSString+Extension.m
//  PhoneCall
//
//  Created by 张伟 on 2021/5/15.
//

#import "NSString+Extension.h"

@implementation NSString (Extension)

+(NSString *)timeStringWith:(NSInteger)time dateFormatter:(NSString *)formatter{
    NSString * str = [NSString stringWithFormat:@"%ld",time];
    if (str.length == 13) {
        time = time / 1000;
    }
    ZWDateFormatter.shareFormatter.dateFormat = formatter;
    NSDate * date = [NSDate dateWithTimeIntervalSince1970:time];
    return [ZWDateFormatter.shareFormatter stringFromDate:date];
}

+ (NSString *)currentTimeString {
    NSDateFormatter * format = NSDateFormatter.new;
    format.dateFormat = @"yyyy-MM-dd HH:mm:ss";
    return [format stringFromDate:NSDate.now];
}

@end
